package com.three.storemanage.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.three.core.entity.CouponCodes;
import com.three.core.vo.R;
import com.three.storemanage.service.CouponCodesService;
import com.three.storemanage.vo.SearchForm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @FileName: CouponCodesController
 * @Description:
 * @Author: GYX
 * @CreateTime: 2025/3/14 9:57
 * @Version: 1.0.0
 */
@RestController
@RequestMapping("store/coupon")
public class CouponCodesController {
    @Autowired
    private CouponCodesService couponCodesService;

    @PostMapping("/selectCouponCodes")
    public R<Page<CouponCodes>> findCouponCodesByCondition(@RequestBody SearchForm searchForm) {
        return couponCodesService.findCouponCodesByCondition(searchForm);
    }

    @GetMapping("/deleteCouponCodes")
    public R deleteCouponCodesById(Integer couponId) {
        return couponCodesService.deleteCouponCodesById(couponId);
    }

    @PostMapping("/insertCouponCodes")
    public R insertCouponCodes(@RequestBody CouponCodes couponCodes) {
        return couponCodesService.insertCouponCodes(couponCodes);
    }

    @PostMapping("/updataCouponCodes")
    public R updateCouponCodes(@RequestBody CouponCodes couponCodes) {
        return couponCodesService.updateCouponCodes(couponCodes);
    }
}
